#include "condition.h"


condition::condition(MutexLock&mutex)
:_mutex(mutex)
{
    pthread_cond_init(&_cond,nullptr);
}
condition::~condition(){
    pthread_cond_destroy(&_cond);
}
void condition::wait(){
    pthread_cond_wait(&_cond,_mutex.getMutexPtr());
}
void condition::notify(){
    pthread_cond_signal(&_cond);
}
void condition::notifyAll(){
    pthread_cond_broadcast(&_cond);
}